﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
				   assembly="AspZone.Commerce.Core"
				   namespace="AspZone.Commerce.Model">

  <class name="Category" table="[dbo].[Category]">

    <id name="Id">
      <column name="CategoryId" not-null="true" />
      <generator class="identity" />
    </id>

    <property name="Name" />
    <property name="ShortDescription" />
    <property name="LongDescription" />
    <property name="SEOTitle" />
    <property name="SEOName" />
    <property name="SEOKeywords" />
    <property name="Hidden" />
    <property name="SortOrder" />

    <many-to-one name="ParentCategory" column="ParentCategoryId" class="Category" />

    
    <bag name="ChildCategories" table="[dbo].[Category]">
      <key column="ParentCategoryId" />
      <one-to-many class="Category" />
    </bag>
    
    <bag name="Products" table="[dbo].[ProductCategory]">
      <key column="[CategoryId]" />
      <many-to-many column="[ProductId]" class="Product" />
    </bag>

    <component name="Image" class="Image">
      <property name="ThumbnailPath"><column name="ImageThumbnailPath" /></property>
      <property name="FullsizePath"><column name="ImageFullsizePath" /></property>
    </component>   

    

  </class>
</hibernate-mapping>
